package Server.Tasks;

import Server.PhoneServerThread;
import Server.PhoneServerThread.States;

public class EndRingingTask extends PhoneTask{
	private PhoneServerThread phone;
	
	public EndRingingTask(int priority, String d, PhoneServerThread phone)
	{
		super(priority, d);
		this.phone = phone;
	}
	
	public void ProcessTask()
	{
		if(phone.getPhoneState() == States.WAITING) {
			phone.setPhoneState(States.NO_CALL);
		} else if(phone.getPhoneState() == States.RINGING) {
			phone.setPhoneState(States.IDLE);
		}
	}
	
	public String GetOutput() {
		return ("EndRinging");
	}
}
